package cn.doitedu.day01.demo

import org.apache.log4j.{Level, Logger}
import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @Date 22.3.28
 * @Created by HANGGE
 * @Description
 */
object WordCount_03 {
   //设置控制台打印日志的日志级别
  Logger.getLogger("org").setLevel(Level.ERROR)
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setAppName("wordcount")
      .setMaster("local")
    val sc = new SparkContext(conf)
    // 加载本地文件   获取一个对象  当成本地集合处理
    val data: RDD[String] = sc.textFile("data/word.txt")

    val res1: RDD[Array[String]] = data.map(line => line.split("\\s+"))
    val res2: RDD[String] = data.flatMap(line => line.split("\\s+"))



  }
}
